<?php

function loginRequired($no_redirect = false){

if(!isset($_SESSION['user'])){

$ref = ($no_redirect == false) ? '?ref='.urlencode($_SERVER['REQUEST_URI']) : '' ;

header("Location: /sign-in".$ref);

}

}

?>